<template>
  <div class="sendgoods">
    <el-dialog title="发送货" :visible.sync="dialogSend" width="30%">
      <el-form ref="form" :model="form" size="medium" label-width="150px">
        <el-form-item label="选择类型:" prop="send_type">
          <el-radio-group v-model="form.send_type">
            <el-radio :label="0">发货</el-radio>
            <el-radio :label="1">送货</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="快递公司:" prop="express" v-if="form.send_type == 0">
          <el-select v-model="form.express" filterable clearable style="width: 100%;">
            <el-option
              v-for="item in expressData"
              :key="item.no"
              :label="item.express"
              :value="item.express">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="快递单号:" prop="express_number" v-if="form.send_type == 0">
          <el-input v-model="form.express_number" clearable placeholder="快递单号"></el-input>
        </el-form-item>
        <el-form-item label="送货人姓名:" prop="send_name" v-if="form.send_type == 1">
          <el-input v-model="form.send_name" clearable placeholder="请输入送货人姓名"></el-input>
        </el-form-item>
        <el-form-item label="送货人电话:" prop="send_phone" v-if="form.send_type == 1">
          <el-input v-model="form.send_phone" clearable placeholder="请输入送货人电话"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="ban-btn">
        <el-button @click="dialogSend = false">取 消</el-button>
        <el-button class="save" @click="ok('form')">提 交</el-button>
      </div>
    </el-dialog>
  </div>

</template>

<script>
export default {
  name: 'SendGoods',
  props:{
    rows:{}
  },
  data() {
    return {
      dialogSend: false,
      form: {
       send_type: 0,
       express: '',
       express_number: ''
      },
      expressData: [
        {
          no: '1',
          express: '中通快递',
          catalog: 'zhongtong',
          status: 1
        },
        {
          no: '2',
          express: '顺丰快递',
          catalog: 'shunfeng',
          status: 0
        },
        {
          no: '3',
          express: '中国邮政',
          catalog: 'intmail',
          status: 0
        }
      ],
    }
  },
  created() {
  },

  methods:{
    //打开对话框
    openSend() {
      this.dialogSend = true;
    },
    //保存表单
    ok () {
      this.$refs['form'].validate(valid => {
        if (valid) {
          console.log(this.form)
          this.$message.success('保存成功')
        } else {
          this.$message.error('表单验证失败!')
        }
      })
    }
  }
}
</script>

<style>
</style>
